<template>
  <div v-if="fileList != null" style="display: flex">
    <div style="width: 2.3rem" class="f14">{{ label }}</div>
    <div style="flex: 1; overflow: hidden; margin-right: 5px">
      <div v-for="(item, index) in fileList" :key="index">
        <div style="color: #1989fa" @click.stop="goFile(item.AttCode)">
          {{ item.AttName + item.AttExt }}
        </div>
      </div>
    </div>
  </div>
</template>

<script>
// 文件描述：   只读List列表   用于展示左文   右集合文件列表   用例：安全生产制度汇编中签发版与附件用法
//更改时间：
export default {
  name: "eagle-file-list",
  props: {
    labelName: {
      type: String,
      required: false,
    },
    attachs: {},
    fileLists: {},
  },
  data() {
    return {
      baseUrl: process.env.VUE_APP_BASE_API,
      fileList: [],
      filePopup: false,
      label: "附件",
      showPdf: false,
      pdfAttcode: "",
      pdfUrl: "",
      showImg: false,
      imagePath: "",
      edit: true,
      require: false,
    };
  },
  created() {
    if (this.labelName) {
      this.label = this.labelName;
    }
    if (this.fileLists) {
      this.fileList = this.fileLists;
    }
    if (this.attachs) {
      this.fileList = JSON.parse(this.attachs);
    }
  },
  methods: {
    goFile(attachCode) {
      this.$router.push("/Attach/AatachDetail?attCode=" + attachCode);
    },
  },
};
</script>

